package com.siteseat.crudeq.client;


public class QueueHistory {
  
  private Integer queueId;

  private int     offset;

  private long    chunkId;
  
  /**
   * @param size
   */
  public QueueHistory( Integer queueId ) {
    this.queueId = queueId;
  }
  
  public QueueHistory() {
    this.queueId = Integer.valueOf( 0 );
  }

  /**
   * @param chunkId
   */
  public void reset( long cid ) {
    this.chunkId = cid;
    this.offset = 0;
    this.queueId = Integer.valueOf( 0 );
  }

  /**
   * Gets the offset
   * 
   * @return the offset
   */
  public int getOffset() {
    return offset;
  }

  /**
   * Gets the queueId
   * 
   * @return the queueId
   */
  public Integer getQueueId() {
    return queueId;
  }

  /**
   * Gets the chunkId
   * 
   * @return the chunkId
   */
  public long getChunkId() {
    return chunkId;
  }

  public boolean olderThan( QueueHistory that ) {
    return this.chunkId < that.chunkId || ( this.chunkId == that.chunkId && this.offset < that.offset );
  }

  /**
   * Sets the offset
   * 
   * @param offset
   *          the offset to set
   */
  public void setOffset( int offset ) {
    this.offset = offset;
  }

  /**
   * Sets the chunkId
   * 
   * @param chunkId
   *          the chunkId to set
   */
  public void setChunkId( long chunkId ) {
    this.chunkId = chunkId;
  }

  /**
   * Sets the queueId
   *
   * @param queueId the queueId to set
   */
  public void setQueueId( Integer queueId ) {
    this.queueId = queueId;
  }

}
